﻿using System;
using System.Collections.Generic;
using System.Text;

namespace MYTech.Oracle
{
    /// <summary>
    /// Oracle数据表
    /// </summary>
    public class Table
    {
        /// <summary>
        /// 创建表实例
        /// </summary>
        public Table()
        { }

        public Table(string tableName)
        {
            this.TableName = tableName;
        }

        public string TableName { get; set; }

        public Field[] Fields { get; set; }

        public string PropertyFields
        {
            get
            {
                if (Fields != null)
                {
                    return Utils.GetPropertyFields(Fields);
                }
                return null;
            }
        }

        public string PartitionBy { get; set; }

        public override string ToString()
        {
            return string.Format("{0}{1}", TableName, (Fields == null || Fields.Length == 0) ? "【不存在】" : string.Format("({0})", Fields.Length));
        }
    }
}
